'use strict';
/**
 * @author chenmin
 * @class  右侧面板组件===>个人名片详情面板===>中间tab病情备注
 */

var React = require('react');
var CartPanelBottomRecord = require('./cartPanelBottomRecord.jsx');
var CartPanelBottomRemarks = require('./cartPanelBottomRemarks.jsx');
var CartPanelBottomHistory = require('./cartPanelBottomHistory.jsx');

var CartPanelBottomHistorySee = require('./cartPanelBottomHistorySee.jsx');


var cartPanelCenter = React.createClass({
      getInitialState:function(){
            return {
                  el:<CartPanelBottomRecord />,
                  active:{
                        record:true,
                        remarks:false,
                        history:false
                  }
            };
      },
      handlerSwitchRecord:function(){
            this.setState({
                  el:<CartPanelBottomRecord />,
                  active:{
                        record:true,
                        remarks:false,
                        history:false
                  }
            });
      },
      handlerSwitchRemarks:function(){
            this.setState({
                  el:<CartPanelBottomRemarks />,
                  active:{
                        record:false,
                        remarks:true,
                        history:false
                  }
            });
      },
      handlerSwitchHistory:function(){
            this.setState({
                  el:<CartPanelBottomHistory propsFun={this.handlerSwitchHistorySee} />,
                  active:{
                        record:false,
                        remarks:false,
                        history:true
                  }
            });
      },
      handlerSwitchHistorySee:function(){
            this.setState({
                  el:<CartPanelBottomHistorySee />,
                  active:{
                        record:false,
                        remarks:false,
                        history:true
                  }
            });
      },
      render: function() {
            var self = this;
            return (
                  /* jshint ignore:start */
                              <div>
                                    <ul className="do-nav-tab-pretty">
                                          <li className={self.state.active.record?'active':''} onClick={self.handlerSwitchRecord}>
                                                <a href="javascript:;" >每日记录</a>
                                          </li>
                                          <li className={self.state.active.remarks?'active':''} onClick={self.handlerSwitchRemarks}>
                                                <a href="javascript:;" >病情备注</a>
                                          </li>
                                          <li className={self.state.active.history?'active':''} onClick={self.handlerSwitchHistory}>
                                                <a href="javascript:;" >提问历史</a>
                                          </li>
                                    </ul>
                                    {self.state.el}
                              </div>
                  /* jshint ignore:end */
            );
   }
});

module.exports = cartPanelCenter;